package com.hertz.appr.service;

import java.util.List;
import java.util.regex.Matcher;

import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;

import com.hertz.appr.dao.IBaseDao;
import com.hertz.appr.pojo.db.Action;
import com.hertz.appr.pojo.db.Answer;
import com.hertz.appr.pojo.db.Member;
import com.hertz.appr.pojo.db.Message;
import com.hertz.appr.util.CmdHelper;
import com.hertz.appr.util.Constants;

public class AnswerService {
	private final Logger log = Logger.getLogger(AnswerService.class);
	
	private IBaseDao<Answer, Long> answerDao;
	private MemberService memberService;
	
	//
	public void saveAnswer(Answer answer){
		answerDao.save(answer);
	}
	
	public Answer getAnswerByActionId(Long aid,String provider){
		String hql = "from Answer where actionId=? and provider=?";
		List<Answer> list = answerDao.find(hql, aid,provider);
		if(list == null || list.size() == 0){
			return null;
		}
		return list.get(0);
	}
	
	public IBaseDao<Answer, Long> getAnswerDao() {
		return answerDao;
	}

	public void setAnswerDao(IBaseDao<Answer, Long> answerDao) {
		this.answerDao = answerDao;
	}

	public MemberService getMemberService() {
		return memberService;
	}

	public void setMemberService(MemberService memberService) {
		this.memberService = memberService;
	}

}
